package com.ssy.lingxi.search.entity;

import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 进货单实体类
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/9/4
 */
@Getter
@Setter
@Entity
@Table(schema = "public", name = "product_shop_purchase", indexes = {@Index(name = "product_shop_purchase_m_id_m_r_id_u_id_idx", columnList = "memberId,memberRoleId,userId"),
        @Index(name = "product_shop_purchase_commodity_unit_price_id_idx", columnList = "commodityUnitPriceId"),
        @Index(name = "product_shop_purchase_m_id_m_r_id_s_id_idx", columnList = "memberId,memberRoleId,shopId"),
        @Index(name = "product_shop_purchase_shop_id_idx", columnList = "shopId")})
public class Purchase implements Serializable {
    private static final long serialVersionUID = -8605744169466466196L;
    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="shop_purchase_seq")
    @SequenceGenerator(sequenceName="product_shop_purchase_seq", name="shop_purchase_seq",allocationSize = 1)
    private Long id;

    /**
     * 商品skuId
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long commodityUnitPriceId;

    /**
     * 商品类型：1-普通商品; 2-套餐商品; 3-秒杀商品; 4-换购商品;
     */
    @Column(columnDefinition = "int")
    private Integer purchaseCommodityType = 1;

    /**
     * 是否主商品
     */
    @Column(columnDefinition = "boolean")
    private Boolean isMain = true;

    /**
     * 套餐id
     */
    @Column(columnDefinition = "int8")
    private Long setMealId;

    /**
     * 套餐名称
     */
    @Column(columnDefinition = "varchar(50)")
    private String setMealName;

    /**
     * 子商品对应的主商品skuId(子商品必填)
     */
    @Column(columnDefinition = "int8")
    private Long parentSkuId;

    /**
     * 数量
     */
    @Column(columnDefinition = "decimal", nullable = false)
    private Double count;

    /**
     * 商城id
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long shopId;

    /**
     * 会员id
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long memberId;

    /**
     * 会员名称
     */
    @Column(columnDefinition = "varchar(50)", nullable = false)
    private String memberName;

    /**
     * 会员角色id
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long memberRoleId;

    /**
     * 会员角色名称
     */
    @Column(columnDefinition = "varchar(50)", nullable = false)
    private String memberRoleName;

    /**
     * 用户id
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long userId;

    /**
     * 用户名称
     */
    @Column(columnDefinition = "varchar(50)", nullable = false)
    private String userName;

    /**
     * 创建时间
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long createTime = System.currentTimeMillis();

    /**
     * 代客下单-客户会员id
     */
    @Column(columnDefinition = "int8")
    private Long customerMemberId;

    /**
     * 代客下单-客户会员角色id
     */
    @Column(columnDefinition = "int8")
    private Long customerMemberRoleId;

    /**
     * 代客下单-订单id
     */
    @Column(columnDefinition = "int8")
    private Long orderId;
}
